import React, { useContext } from 'react'
import { countContext } from './A'

export default function C() {
    //3.  使用 useContext()  hook  使用上下文对象
    let [count,setCount]=useContext(countContext)

    //+1
    let add=()=>{
        setCount(++count)
        console.log(count);
    }

  return (
    <div>
        <h1>孙组件c:{count}</h1>
        <button onClick={add}>+1</button>

    </div>
  )
}
